import Router from 'koa-router'
import { getControllers,regControlers } from '../utils/tools.js'
import bodyParser from 'koa-bodyparser';
import cors from '@koa/cors'

let router = new Router();


export const useControllers = function (app) {
    app.use(cors());
    app.use(bodyParser());

    let controllerFiles = getControllers();
    regControlers(router,controllerFiles);
    app.use(router.routes())
}